<template>
    <div class="swiper">
        <swiper :options="swiperOptions">
                <swiper-slide v-for="item of swiperList" :key="item.id">
                    <img :src="item.imgUrl" />
                </swiper-slide>
            </swiper>
    </div>
</template>
<script>
    import Vue from 'vue';
    import { Swiper as SwiperClass, Pagination, Mousewheel, Autoplay, EffectCube,Navigation} from 'swiper/swiper.esm'
    import getAwesomeSwiper from 'vue-awesome-swiper/dist/exporter'
    SwiperClass.use([Pagination, Mousewheel, Autoplay, EffectCube,Navigation])
    Vue.use(getAwesomeSwiper(SwiperClass))
    const { Swiper, SwiperSlide } = getAwesomeSwiper(SwiperClass)
    import 'swiper/swiper-bundle.css'


export default {
    data() {
        return {
             swiperOptions: {
                autoplay: true,   // 自动切换图片
                loop: true,     //图片轮询
            },

            swiperList: [{
                    "id": "0001",
                    "imgUrl": "http://img1.qunarzz.com/piao/fusion/1801/1a/94428c6dea109402.jpg_640x200_2cf590d8.jpg"
                },{
                    "id": "0002",
                    "imgUrl": "http://img1.qunarzz.com/piao/fusion/1802/42/7c92b9a381e46402.jpg_640x200_1cdce2a4.jpg"
                },{
                    "id": "0003",
                    "imgUrl": "http://img1.qunarzz.com/piao/fusion/1802/51/e78f936a5b404102.jpg_640x200_c14f0b3a.jpg"
                },{
                    "id": "0004",
                    "imgUrl": "http://img1.qunarzz.com/piao/fusion/1712/91/a275569091681d02.jpg_640x200_0519ccb9.jpg"
             }],
        }
    },
    components: {
        SwiperClass,
        SwiperSlide,
   },

}
</script>
<style lang="scss">
    .swiper{
        width:100%;
        height:0px;
        overflow: hidden;
        padding-bottom: 31.25%;
        background-color: #eee
        ;
        img{
            width:100%;
        }
    }
</style>